home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COLOR.SWG / 0004_DOS Colors.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  37 lines

  1. {
  2. > I want to be able to read a users Text Attrib and store them so i can
  3. > restore them when my Program ends.  How can I do this?
  4.  
  5. It seems strange you would only want to save Text attribute and
  6. not the Dos screen, but that is what you ask -- as I understand it.
  7.  
  8. You need to read the attribute of Character at or one column
  9. beFore the current cursor position, directly from the screen. Something
  10. like this should do:
  11. }
  12.  
  13. Uses
  14.   Crt;
  15.  
  16. Function UserAttr: Byte;
  17. Var VSeg: Word;
  18. begin
  19.   if LastMode = 7 then
  20.     VSeg := $B000          { Monochrome }
  21.   else
  22.     VSeg := $B800;         { Color }
  23.   if (WhereX = 1) and (WhereY = 1) then
  24.     UserAttr := Hi(MemW[VSeg:0])
  25.   else
  26.     UserAttr := Hi(MemW[VSeg:(WhereX -1) + (MemW[$40:$4A] * (WhereY -1)) -2]);
  27. end;
  28.  
  29. (*
  30. BeFore returning to Dos, Write one space With given attribute and
  31. backspace over it (this will cause Dos to continue in the same color):
  32.  
  33. TextAttr := OldAttr;    { OldAttr initialized at Program startup }
  34. Write(#20#8);
  35. *)
  36.  
  37.